package jam.network.message;

import jam.UserInterface.UI.UIController;
import jam.network.NetworkController;
import java.util.Scanner;

public class ServerActionMessage extends ServerAction {

	public static void process(String msg) {

		Scanner s = new Scanner(msg);
		s.useDelimiter(":");

		//skip keyword and transID
		s.next();
		int id = s.nextInt();

		String channel = s.next();
		String user = s.next();
		String data = "";
		while ( s.hasNext() )
			data += (s.next() + ":");

		System.out.println(channel + " - " + user + ": " + data);
		UIController.incomingMessage(user, data);

		NetworkController.send( ("SA_MSG:" + id + ":TRUE") );
	}

}